<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>查看我发布的信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="js/jquery-1.4.4.js"	charset="utf-8"></script>
	<style type="text/css">
		td {border: 1px solid black;}
	</style>
  </head>
  
  <body>
   		 <br>
   		  查看我发布的信息
   		 <table style="border: 1px solid black;">
   		 	<thead>
   		 		<tr>
   		 			<td>标题</td><td width="50px;">意图</td><td>发布时间</td><td>更新时间</td><td>详细描述</td><td width="40px;">回复人数</td><td width="220px;">操作</td>
   		 		</tr>
   		 	</thead>
   		 	<tbody id="table_body">
   		 	</tbody>
   		 </table>
  </body>
  <script type="text/javascript">
  	var rootPath='<%=path%>';
  	$.post(rootPath+"/json/getMyGoods.action",
		{},
		function(data){
			for(var i=0;i<data.goods.length;i++){
				$('<tr>'+
   		 			'<td>'+data.goods[i].title+'</td>' +
   		 			'<td>'+data.goods[i].supplyordemand+'</td>' +
   		 			'<td>'+data.goods[i].publishTime+'</td>' +
   		 			'<td>'+data.goods[i].updateTime+'</td>' +
   		 			'<td>'+data.goods[i].description+'</td>' +
   		 			'<td>'+data.goods[i].replayNum+'</td>' +
   		 			'<td><a onclick="refreshMygoods('+data.goods[i].id+')" style="color: blue;cursor: pointer;font-weight: normal;text-decoration: underline;">刷新</a>&nbsp;' +
   		 			'<a href="modifygoods.action?goodsid='+data.goods[i].id+'">编辑</a>&nbsp;'+
   		 			'<a href="acquireMyGoodsById.action?goodsId='+data.goods[i].id+'">查看详细&nbsp;</a>'+
   		 			'<a href="deletegoods1.action?goodsid='+data.goods[i].id+'">删除</a></td>'+
   		 		'</tr>').appendTo("#table_body");
			}
		},
		"json"
	);
  	function refreshMygoods(goodsID){
  		$.post(rootPath+"/json/refreshGoods.action",
		{goodsId:goodsID},
		function (data){
			alert(data.result);
			window.location.reload();
		},
		'json');
  	}
  </script>
</html>
